package drawapp.cw.com.recyclerviewdemo;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.util.AttributeSet;

/**
 * Created by lenovo on 2016/12/20.
 */
public class MyStaggeredGridLayoutManager extends StaggeredGridLayoutManager implements ILayoutManager {
    public MyStaggeredGridLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    public MyStaggeredGridLayoutManager(int spanCount, int orientation) {
        super(spanCount, orientation);
    }

    @Override
    public boolean loadMore() {
        int positions[] = null;
        positions = findLastVisibleItemPositions(positions);
        return getItemCount() - positions[0] <= 3;
    }

    @Override
    public RecyclerView.LayoutManager getLayoutManager() {
        return this;
    }
}
